package 多线程.生产者消费者模式;
//生产者类
public class Producer implements Runnable {
    private  Box b;
    public Producer(Box b) {
    this.b = b;
    }

    @Override
    public void run() {
        for (int i = 1; i <= 5; i++) {
            try {
                b.put(i);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
